﻿<UserControl x:Class="RL.ucScheduleRL"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="298" d:DesignWidth="657">
    <UserControl.Resources>
        <CollectionViewSource x:Key="sourceSchedule" />
        <CollectionViewSource x:Key="sourceRoutes" />
        <DataTemplate x:Key="cellRoute">
            <!--<ComboBox ItemsSource="{Binding Source={StaticResource sourceRoutes}}" DisplayMemberPath="number" SelectedValue="{Binding Path=RouteTable}" SelectedValuePath="id_route"/> -->
            <ComboBox ItemsSource="{Binding Source={StaticResource sourceRoutes}}" DisplayMemberPath="number" SelectedValuePath="id" SelectedItem="{Binding Path=Routes, Mode=TwoWay}" IsSynchronizedWithCurrentItem="False"/>
        </DataTemplate>

        <DataTemplate  x:Key="cellBusstop">
            <TextBox Text="{Binding Path=name_busstop}" />
        </DataTemplate>
        <DataTemplate x:Key="cellArrive">
            <TextBox Text="{Binding Path=time_arrive}" />
        </DataTemplate>
        <DataTemplate x:Key="cellDeparture">
            <TextBox Text="{Binding Path=time_departure}" />
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Name="stackPanel1" Orientation="Horizontal">
            <Button Content="Добавить" Height="23" Name="buttonAddSchedule" Width="75" Click="buttonAddSchedule_Click" />
            <Button Content="Удалить" Height="23" Name="buttonDeleteSchedule" Width="75" Click="buttonDeleteSchedule_Click" />
            <Button Visibility="Hidden" Content="Редактировать" Height="23" Name="buttonEditSchedule" Width="103" Click="buttonEditSchedule_Click" />
        </StackPanel>
        <ListView Grid.Row="1" Name="listViewSchedule" Margin="0"  ItemsSource="{Binding Source={StaticResource sourceSchedule}}">
            <ListView.View>
                <GridView>
                    <!-- <GridViewColumn Header="Выкл." Width="30" CellTemplate="{StaticResource cellDel}"/> -->
                    <GridViewColumn Header="Маршрут" Width="100" CellTemplate="{StaticResource cellRoute}"/>
                    <GridViewColumn Header="Пункт" Width="200" CellTemplate="{StaticResource cellBusstop}"/>
                    <GridViewColumn Header="Приб." Width="60" CellTemplate="{StaticResource cellArrive}"/>
                    <GridViewColumn Header="Отпр." Width="60" CellTemplate="{StaticResource cellDeparture}"/>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</UserControl>
